package com.atguigu.ggkt.order.api;

import com.atguigu.ggkt.model.order.OrderInfo;
import com.atguigu.ggkt.order.service.OrderInfoService;
import com.atguigu.ggkt.result.Result;
import com.atguigu.ggkt.vo.order.OrderFormVo;
import com.atguigu.ggkt.vo.order.OrderInfoVo;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * FileName:     OrderInfoApiController
 * CreateBy:     IntelliJ IDEA
 * Author:       wei
 * Date:         2023-02-23
 * Description :
 */
@RestController
@RequestMapping("api/order/orderInfo")
public class OrderInfoApiController {
    @Autowired
    private OrderInfoService orderInfoService ;

    @PostMapping("submitOrder")
    public Result submitOrder(@RequestBody OrderFormVo orderFormVo){
        Long orderId  =orderInfoService.submitOrder(orderFormVo);
        return Result.ok(orderId);
    }

    @ApiOperation(value = "获取")
    @GetMapping("getInfo/{id}")
    public Result getInfo(@PathVariable Long id) {
        OrderInfoVo orderInfoVo = orderInfoService.getOrderInfoById(id);
        return Result.ok(orderInfoVo);
    }


}
